
class Animals{
	public String name;
	public int age;
	public Animals(String name,int age){
		this.name = name;
		this.age = age;
	}
	public void eat(){
		System.out.println(name+"正在吃饭");
	}
}
class Dog extends Animals{
	public String name;
	public boolean silly;
	public Dog(String name,int age,boolean silly){
		//这是一个三个参数的构造方法
		//构造方法的作用：给成员变量初始化
		//1. 先帮助父类部分初始化
		super(name,age);
		this.silly = silly;
	}
	public void backs(){
		//System.out.println(name+"正在汪汪叫");
		System.out.println(super.name+"正在汪汪叫");
	}

}
/*class Cat extends Animals{
	public void catchMouse(){
		System.out.println(name+"正在抓老鼠");
	}

}*/

public class Test{
	public static void main(String[] args) {
		/*Dog dog = new Dog();
		dog.name = "小灰";*/
		Dog dog = new Dog("hello",10,false);
		/*Animals animals = new Animals();
		//如何给父类中的成员赋值
		animals.name = "大黄";//？？？为什么这样不可以给Animals里的name赋值*/
		dog.backs();

	}

}


